Round fractional time when reading XML beyond milliseoconds.
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 17 Jul 2013 01:38:35 +0000 (01:38 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 17 Jul 2013 01:38:35 +0000 (01:38 +0000)
gpsbabel/gpx.cc

index eda1ff374ff5b0e00caf4f493945c3b5f85ff902..166d1280bf1b8a5b654a1a2aa1d0e5929f11b832 100644 (file)
@@ -22,6 +22,7 @@
 #include "defs.h"
 #include "cet_util.h"
 #include "garmin_fs.h"
+#include <math.h>
 #if HAVE_LIBEXPAT
 #include <expat.h>
 static XML_Parser psr;
@@ -903,7 +904,7 @@ xml_parse_time(const char* cdatastr)
 
   // Fractional part of time.
   if (fsec) {
-    time = time.addMSecs(fsec * 1000);
+    time = time.addMSecs(lround(fsec * 1000));
   }
 
   // Any offsets that were stuck at the end.